package com.app.couponsharelife.ui.main.me.customerservice

import android.content.ClipData
import android.content.ClipboardManager
import android.content.Context
import com.app.couponsharelife.R
import com.app.couponsharelife.base.BaseActivity
import com.app.couponsharelife.utils.AppUtils
import kotlinx.android.synthetic.main.activity_customer_service.*

class CustomerServiceActivity : BaseActivity() {

    override val viewLayoutId: Int get() = R.layout.activity_customer_service

    override fun initViews() {
        AppUtils.initImmersionBar(this,false)
        initToolBar()
    }

    private fun initToolBar() {
        ivBack.setOnClickListener { finish() }
        tvUpdateVersionBtn.setOnClickListener {
            copyInviteCode("17300921190")
        }
    }

    private fun copyInviteCode(code: String) {
        //获取剪贴板管理器：
        val cm = getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
        // 创建普通字符型ClipData
        val mClipData = ClipData.newPlainText("Label", code)
        // 将ClipData内容放到系统剪贴板里。
        cm.primaryClip = mClipData
        showToastMsg("微信号已复制")
    }

    override fun onDestroy() {
        super.onDestroy()
        AppUtils.destroyImmersionBar(this)
    }
}
